package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ChatMessageReadMapper;
import com.ruoyi.system.domain.ChatMessageRead;
import com.ruoyi.system.service.IChatMessageReadService;

/**
 * 消息已读状态Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-30
 */
@Service
public class ChatMessageReadServiceImpl implements IChatMessageReadService 
{
    @Autowired
    private ChatMessageReadMapper chatMessageReadMapper;

    /**
     * 查询消息已读状态
     * 
     * @param id 消息已读状态主键
     * @return 消息已读状态
     */
    @Override
    public ChatMessageRead selectChatMessageReadById(Long id)
    {
        return chatMessageReadMapper.selectChatMessageReadById(id);
    }

    /**
     * 查询消息已读状态列表
     * 
     * @param chatMessageRead 消息已读状态
     * @return 消息已读状态
     */
    @Override
    public List<ChatMessageRead> selectChatMessageReadList(ChatMessageRead chatMessageRead)
    {
        return chatMessageReadMapper.selectChatMessageReadList(chatMessageRead);
    }

    /**
     * 新增消息已读状态
     * 
     * @param chatMessageRead 消息已读状态
     * @return 结果
     */
    @Override
    public int insertChatMessageRead(ChatMessageRead chatMessageRead)
    {
        chatMessageRead.setCreateTime(DateUtils.getNowDate());
        return chatMessageReadMapper.insertChatMessageRead(chatMessageRead);
    }

    /**
     * 修改消息已读状态
     * 
     * @param chatMessageRead 消息已读状态
     * @return 结果
     */
    @Override
    public int updateChatMessageRead(ChatMessageRead chatMessageRead)
    {
        return chatMessageReadMapper.updateChatMessageRead(chatMessageRead);
    }

    /**
     * 批量删除消息已读状态
     * 
     * @param ids 需要删除的消息已读状态主键
     * @return 结果
     */
    @Override
    public int deleteChatMessageReadByIds(Long[] ids)
    {
        return chatMessageReadMapper.deleteChatMessageReadByIds(ids);
    }

    /**
     * 删除消息已读状态信息
     * 
     * @param id 消息已读状态主键
     * @return 结果
     */
    @Override
    public int deleteChatMessageReadById(Long id)
    {
        return chatMessageReadMapper.deleteChatMessageReadById(id);
    }
}
